﻿using System;
using Microsoft.TeamFoundation.Build.Client;
using Microsoft.VisualStudio.TestTools.UnitTesting;
using UCL.Powersource;
using UCL.Powersource.Mock;
using UCL.Powersource.TFS;

namespace Powersource_UnitTests.MockTfsObjectTest
{
    [TestClass]
    public class TfsFactoryAdapterTest
    {
        [TestMethod]
        public void TfsFactoryAdapterCreation()
        {
            //var coll1 = DummyTfsTeamProjectCollectionFactory.Default.GetTeamProjectCollection(new Uri("http://81.2.210.131:8080/tfs/FabrikamFiberCollection"));
            //Assert.AreNotEqual(typeof(TfsTeamProjectCollectionAdapter), coll1.GetType(), "Factory adapter returning mock object while not in test mode");
            //DummyTfsTeamProjectCollectionFactory.Default.InTestMode = true;
            //var coll2 = DummyTfsTeamProjectCollectionFactory.Default.GetTeamProjectCollection(new Uri("http://81.2.210.131:8080/tfs/FabrikamFiberCollection"));
            //Assert.AreEqual(typeof(TfsTeamProjectCollectionAdapter), coll2.GetType(), "Factory adapter not returning mock object while in test mode");
            //var coll3 = DummyTfsTeamProjectCollectionFactory.Default.GetTeamProjectCollection(new Uri("http://81.2.210.131:8080/tfs/FabrikamFiberCollection"));
            //Assert.AreEqual(coll2, coll3, "Factory adapter not returning same object for same uri");
            //var serv = coll2.GetService<IBuildServer>();
            //Assert.AreEqual(typeof(MockBuildServer), serv.GetType(), "Collection adapter not returning mock object while in test mode");
        }
    }
}
